package com.mayikt.thread;

/**
 * @ClassName Thread006
 * @Author 蚂蚁课堂余胜军 QQ644064779 www.mayikt.com
 * @Version V1.0
 **/
public class Thread006 implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + ",我是子线程");
        a();
    }

    public synchronized void a() {
        // this 锁
        System.out.println(Thread.currentThread().getName() + ",我是方法A 开始");
        b();
        System.out.println(Thread.currentThread().getName() + ",我是方法A 结束");
    }

    public synchronized void b() {
        System.out.println(Thread.currentThread().getName() + ",我是方法B");
    }

    public static void main(String[] args) {
        // 如果我们的锁具有可重入性的情况下
    }
}